# file:: room.rb
# author::  Ralph M. Churchill
# version::
# date::
#
# This source code copyright (C) 2006 by Ralph M. Churchill
# All rights reserved.
#
# Released under the terms of the GNU General Public License
# See LICENSE file for additional information.

require 'models/entity'
require 'models/container'
require 'models/logic_entity'
require 'models/describable_entity'

class Room < Entity
    include ActsLikeLogicEntity,IsDescribable
    include BelongsToRegion,HasManyCharacters,HasManyItems,HasManyPortals

    def exits
        exits = []
        self.portals.each do |portal|
            exits << portal.entries.select{|entry| entry.start_room == self}
        end
        exits.flatten
    end

    def standard_description
        desc = %{\
        <%= name %>
        <%= description %>
        <%= characters.join(', ')%> <%=characters.size > 1 ? 'are' : 'is'%> here.
        <%unless items.empty?%>
        You see: <%=items.join(', ')%>
        <%end%>
        Exits:<%exits.each do |e|%>
            <%=e%>
        <%end%>
        <% red do %>_+_<% end %>
        }.gsub(/^       /, '')
        desc
    end
end
